import { SerializeStream } from "../../Framework/Serialize/SerializeStream";
import { MarshalException } from "./MarshalException";
type int = number;
//class ERMICallModel

export class ERMICallModel {
  constructor(code: int) {
    this.__value = code;
    ERMICallModel.__values[code] = this;
  }

  public value(): int {
    return this.__value;
  }

  public toString(): string {
    return ERMICallModel.__T[this.__value];
  }

  public equals(arg1: any): Boolean {
    if (this == arg1) {
      return true;
    }
    var loc1 = arg1 as ERMICallModel;
    if (loc1 == null) {
      return false;
    }
    return this.__value == loc1.value();
  }

  public hashCode(): int {
    return 5 * this.__value;
  }

  public __write(stream: SerializeStream): void {
    stream.writeByte(this.__value);
    return;
  }

  public static convert(arg1: int): ERMICallModel {
    return ERMICallModel.__values[arg1];
  }

  public static __read(arg1: SerializeStream): ERMICallModel {
    var code = arg1.readByte();
    if (code < 0 || code >= 2) {
      throw new MarshalException();
    }
    return ERMICallModel.convert(code);
  }

  private static /* const */ __T: Array<any> = [
    "ERMICallModel.CallModelSync",
    "ERMICallModel.CallModelAsync"
  ];

  private static /* var */ __values: Array<ERMICallModel> = [];

  public static /* const */ _CallModelSync: int = 0;

  public static /* const */ CallModelSync: ERMICallModel = new ERMICallModel(
    ERMICallModel._CallModelSync
  );

  public static /* const */ _CallModelAsync: int = 1;

  public static /* const */ CallModelAsync: ERMICallModel = new ERMICallModel(
    ERMICallModel._CallModelAsync
  );

  public /* var */ __value: int;
}
